/*
 * @lc app=leetcode.cn id=1528 lang=javascript
 *
 * [1528] 重新排列字符串
 */

// @lc code=start
/**
 * @param {string} s
 * @param {number[]} indices
 * @return {string}
 */
var restoreString = function (s, indices) {
  return indices
    .map((item, index) => ({ ch: s[index], index: item }))
    .sort((a, b) => a.index - b.index)
    .map(item => item.ch)
    .join('');
};
// @lc code=end

